package utils;

import org.json.JSONArray;

import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Random;

public class ReadWorkNumber {


    public static JSONArray read() throws IOException {
        BufferedReader br = new BufferedReader(new FileReader("123.txt"));
        String line = null;
        ArrayList<String> list=new ArrayList<>();

        JSONArray jsons = new JSONArray();

        while ((line = br.readLine()) != null) {
            list.add(line);
//            jsons.put(i, line);
//
        }
        for (int j=0 ;j<169;j++){
            int num=new Random().nextInt(list.size()-1);
            jsons.put(j,list.get(num));
            list.remove(num);
        }

        System.out.println(jsons.toString());
        return jsons;
    }
}
